//
// Created on 2024/7/31.
//
// Node APIs are not fully supported. To solve the compilation error of the interface cannot be
// found, please include "napi/native_api.h".

#ifndef ARKUI_C_API_ARKUILISTNODE_H
#define ARKUI_C_API_ARKUILISTNODE_H

#include "src/ArkUINode.h"

namespace NativeModule {

class ArkUIListNode : public ArkUINode {
public:
    ArkUIListNode()
        : ArkUINode(NativeModuleInstance::getInstance()->GetNativeNodeAPI()->createNode(
              ARKUI_NODE_LIST)) {}

    ~ArkUIListNode() override {}

    void SetScrollBarState(bool isShow) {
        assert(handle_);
        ArkUI_ScrollBarDisplayMode displayMode =
            isShow ? ARKUI_SCROLL_BAR_DISPLAY_MODE_ON : ARKUI_SCROLL_BAR_DISPLAY_MODE_OFF;
        ArkUI_NumberValue value[] = {{.i32 = displayMode}};
        ArkUI_AttributeItem item = {value, 1};
        nativeModule_->setAttribute(handle_, NODE_SCROLL_BAR_DISPLAY_MODE, &item);
    }
};

} // namespace NativeModule

#endif // ARKUI_C_API_ARKUILISTNODE_H
